package accs.model.io;

import java.io.IOException;

import accs.model.UserPasswordPair;

public class TrimFilter extends UserPasswordReader {

	private UserPasswordReader reader;
	
	public TrimFilter(UserPasswordReader reader) {
		this.reader=reader;
	}
	
	public UserPasswordPair read() throws IOException {
		UserPasswordPair pair=reader.read();
		if(pair==null) return null;
		
		pair.setUsername(pair.getUsername().trim());
		pair.setPassword(pair.getPassword().trim());
		return pair;
	}

	public void close() throws IOException {
		reader.close();
	}
}